package com.kamisama.utopia.constant.character;

import org.springframework.util.ObjectUtils;

public class Magic {
    public static final String LV1 = "即将耗尽";
    public static final String LV2 = "常人所及";
    public static final String LV3 = "马猴烧酒";
    public static final String LV4 = "无声吟唱";
    public static final String LV5 = "超位魔法";

    public static String formatMagic(Double magical) {
        if (!ObjectUtils.isEmpty(magical)) {
            int magicPercent = magical.intValue();
            String magic = "";
            if (magicPercent <= 20) {
                magic = "魔法：" + Magic.LV1;
            } else if (magicPercent <= 40) {
                magic = "魔法：" + Magic.LV2;
            } else if (magicPercent <= 60) {
                magic = "魔法：" + Magic.LV3;
            } else if (magicPercent <= 80) {
                magic = "魔法：" + Magic.LV4;
            } else {
                magic = "魔法：" + Magic.LV5;
            }
            magic = magic + " [" + magicPercent +"%] \n";
            return magic;
        } else {
            return "";
        }
    }
}
